<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
		<script src="vue.js" type="text/javascript" charset="UTF-8"></script>
		<script src="axios.min.js" type="text/javascript" charset="UTF-8"></script>
	</head>
	<body>
		<div id="app">
			<table class="table">
				<tr>
					<th>编号</th>
					<th>小说名称</th>
					<th>小说作者</th>
					<th>类型</th>
					<th>小说封面</th>
				</tr>
				<tr v-for="v in collection">
					<td>{{v.ID}}</td>
					<td>{{v.name}}</td>
					<td>{{v.author}}</td>
					<td>{{v.types}}</td>
					<td><img :src="v.img" width="60px"></td>
				</tr>
			</table>
			<input type="button" value="上一页" @click="getpage(page-1)">
			<input type="button" :value="v" v-for="v in sumpage" @click="getpage(v)">
			<input type="button" value="下一页" @click="getpage(page+1)">
		</div>
	</body>
</html>
<script>
var app=new Vue({
	el:"#app",
	data:{
		collection:[],
		page:"",
		size:"",
		count:"",
		sumpage:"",
	},
	methods:{
		getpage(page){
			axios.get("http://127.0.0.1:8080/collection/list?page="+page).then(function(res){
				app.collection=res.data.data
				app.page=res.data.page
				app.size=res.data.size
				app.count=res.data.count
				app.sumpage=res.data.sumpage
			})
		},
	},
	created:function(){
		axios.get("http://127.0.0.1:8080/collection/list").then(function(res){
			console.log(res.data)
			app.collection=res.data.data
			app.page=res.data.page
			app.size=res.data.size
			app.count=res.data.count
			app.sumpage=res.data.sumpage
		})
	}
})
</script>